'use strict';

webappApp.controller('SpotCtrl', ['$scope', '$routeParams', '$filter', '$location', 'spotService', function ($scope, $routeParams, $filter, $location, spotService) {
  $scope.spot = spotService.get($routeParams.id, 
    function (spot) {
      $scope.marker = $filter('marker')(spot.location, $scope.map);
    }, function(response) {
      if (response.status === 404) {
        $location.path('404.html');
      }
    });
}]);